#ifndef _INT_X86_H
#define _INT_X86_H

#include "types_x86.h"

static inline void x86_intr_dis(void)
{
    asm volatile("cli");
}

static inline void x86_intr_en(void)
{
    asm volatile("sti");
}

static inline u32 x86_intr_get(void)
{
    u32 eflags;

    asm volatile("pushfl; popl %0" : "=r" (eflags));

    return (eflags & (1 << 9)) != 0;
}

static inline void x86_intr_put(u32 flags)
{
    if (flags & 1) {
        x86_intr_en();
    } else {
        x86_intr_dis();
    }
}

#endif /* _INT_X86_H */